#pragma once

#include <WinSock2.h>
#include <Windows.h>
#include <thread>
#include <list>
#include <map>

#pragma comment(lib, "Ws2_32.lib")

class CInitSock
{
public:
	static void Initial(BYTE minorVer = 2, BYTE majorVer = 2) {
		if (mThis == NULL) {
			WSADATA wsaData;
			WORD sockVersion = MAKEWORD(minorVer, majorVer);
			if (::WSAStartup(sockVersion, &wsaData) != 0)
			{
				exit(0);
			}
			mThis = new CInitSock();
		}
	}
private:
	CInitSock() {}
	~CInitSock()
	{
		::WSACleanup();
	}
	static CInitSock* mThis;
};